package com.qf.service;

import com.qf.dao.GoodsDao;
import com.qf.pojo.Goods;

import java.util.List;

/**
 * @author 汤奇
 * @version V1.0
 * @Project BookPro
 * @Package com.qf.service
 * @Description:
 * @Date 2022/5/24 21:47
 */
public class GoodsServiceImpl implements GoodsService {
    private GoodsDao goodsDao;

    public GoodsServiceImpl(GoodsDao goodsDao) {
        this.goodsDao = goodsDao;
    }

    /**
     * 添加商品
     * */
    @Override
    public int addGoods(Goods goods) {
        int count = goodsDao.insertGoods(goods);
        return count;
    }

    @Override
    public List<Goods> findGoodsAll() {
        List<Goods> list = goodsDao.findGoodsAll();
        return list;
    }

    @Override
    public Goods findGoodsById(Integer id) {
        Goods goods = goodsDao.findGoodsById(id);
        return goods;
    }
}
